<?php 
require_once("../connect_db.php");
$sql1="select sum(price) as sumAll from student,course,orders,teacher
where student.std_id=orders.std_id 
and orders.course_id=course.course_id and orders.teach_id=teacher.teach_id
and order_date_regis>='".$_GET["start"]."' and order_date_regis<='".$_GET["stop"]."'  ";
$query1=mysql_query($sql1);
$result1=mysql_fetch_array($query1);


?>

<form method="post" enctype="multipart/form-data" name="frmreg" id="frmreg">

<div class="row">
	<div class="col-md-12">
		<div class="panel">
		 
		  <div class="panel-body">
		
		  
			<table cellpadding="0" cellspacing="0" border="0" class="display" id="Teacher" width="100%" style="font-size:14px">
	<thead>
		<tr>
		<th style="width:40%;text-align: center !important;color:black; !important;font-size:1em">รายการ</th>
		<th style="width:40%;text-align: center !important;color:black; !important;font-size:1em">จำนวนเงิน</th>
		</tr>
	</thead>
	<tbody style="color:black !important;">
	
		<?php
		if($result1["sumAll"]>0){
		?>
		<tr>
			<td style="text-align: center !important;color:black; !important;font-size:1em"><a href="#" onclick="Javascript:link_tb(0);"><b>รายรับ</b></a></td>
			<td style="text-align: center !important;color:black; !important;font-size:1em"><?php echo $result1["sumAll"]?></td>
		</tr>
			<?php
			}
			$sql2="select sum(cost_price) as sumAll from costlearn
where cost_date>='".$_GET["start"]."' and cost_date<='".$_GET["stop"]."'  ";
$query2=mysql_query($sql2);
$result2=mysql_fetch_array($query2);
		if($result2["sumAll"]>0){
		?>
			<tr>
			<td style="text-align: center !important;color:black; !important;font-size:1em"><a href="#" onclick="Javascript:link_tb(1);"><b>รายจ่าย</b></a></td>
			<td style="text-align: center !important;color:black; !important;font-size:1em"><?php echo $result2["sumAll"]?></td>
		</tr>
		<?php
		}
		?>
	</tbody>
	
</table>
		  </div>
		</div>
	</div>
</div>
</div>


</form>
<script>


$(document).ready(function(){
$(".nav_link2").click(function(e){
				$("#h3title").html($(this).attr("txt"));
				$("#mainscreen").load($(this).attr("url"));
				return false;
			});
  	oTable = $('#Teacher').dataTable({
          "bJQueryUI": true,
          "sPaginationType": "full_numbers"
      });

 
});
	 
</script>